home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Event;
- import java.awt.Frame;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.MediaTracker;
- import java.net.URL;
-
- public class magicimage extends Applet implements Runnable {
- Thread runner;
- String image_align = "left";
- String image_valign = "left";
- String bgcolor = "";
- String target_frame = "";
- String infostr = "";
- String link1 = "";
- String scroll_way = "";
- String status_bar = "";
- String regcode = "";
- String errstr = "";
- Image offimg;
- Image offimg2;
- Image imgust;
- Image imgalt;
- int bgci;
- int genislik;
- int yukseklik;
- int delay_time;
- int durum;
- // $FF: renamed from: X int
- int field_0;
- int imgwidth;
- int imgheight;
- int kaplaboy;
- int kaplayuk;
- int don;
- int don2;
- // $FF: renamed from: XX int
- int field_1;
- // $FF: renamed from: YY int
- int field_2;
- int imgw;
- int imgh;
- Color bgc;
- MediaTracker tracker;
- Graphics offScreeng;
- Graphics offScreeng2;
- // $FF: renamed from: u java.net.URL
- URL field_3;
- boolean inf = false;
- // $FF: renamed from: rg boolean
- boolean field_4 = false;
- boolean whb = false;
-
- public void init() {
- this.genislik = -1;
- this.yukseklik = -1;
- this.whb = false;
- this.durum = 0;
- this.field_0 = 0;
- this.kaplaboy = 0;
- this.kaplayuk = 0;
- this.bgcolor = ((Applet)this).getParameter("bgcolor");
-
- try {
- this.bgci = Integer.parseInt(this.bgcolor, 16);
- } catch (Exception var2) {
- this.bgci = 0;
- }
-
- this.bgc = new Color(this.bgci);
- ((Component)this).setBackground(this.bgc);
- this.image_align = ((Applet)this).getParameter("image_align");
- this.image_valign = ((Applet)this).getParameter("image_valign");
- this.link1 = ((Applet)this).getParameter("link");
- this.regcode = ((Applet)this).getParameter("regcode");
- if (this.regcode != null && this.regcode.equals("mimg35856")) {
- this.field_4 = true;
- }
-
- this.infostr = ((Applet)this).getParameter("info");
- this.status_bar = ((Applet)this).getParameter("status_bar");
- this.scroll_way = ((Applet)this).getParameter("scroll_way");
- this.target_frame = ((Applet)this).getParameter("target_frame");
-
- try {
- this.delay_time = Integer.parseInt("" + ((Applet)this).getParameter("delay_time"), 10);
- } catch (Exception var1) {
- this.delay_time = 2000;
- }
-
- this.tracker = new MediaTracker(this);
- this.imgust = ((Applet)this).getImage(((Applet)this).getCodeBase(), ((Applet)this).getParameter("foreground_image"));
- this.imgalt = ((Applet)this).getImage(((Applet)this).getCodeBase(), ((Applet)this).getParameter("background_image"));
- this.tracker.addImage(this.imgust, 1);
- this.tracker.addImage(this.imgalt, 2);
- }
-
- public void update(Graphics var1) {
- if (this.whb) {
- this.offScreeng.setColor(this.bgc);
- this.offScreeng.fillRect(0, 0, this.genislik, this.yukseklik);
- if (this.durum == 0) {
- this.offScreeng.setColor(Color.black);
- this.offScreeng.drawString("Loading...", 10, 20);
- this.offScreeng.setColor(this.bgc);
- }
-
- if (this.durum == 1) {
- this.offScreeng.setColor(Color.black);
- this.offScreeng.drawString("" + this.errstr, 10, 20);
- this.offScreeng.setColor(this.bgc);
- }
-
- if (this.durum == 2) {
- this.offScreeng.drawImage(this.offimg2, this.field_0, 0, this);
- this.offScreeng.drawImage(this.imgust, this.field_1, this.field_2, this);
- }
-
- this.paint(var1);
- }
-
- }
-
- public void paint(Graphics var1) {
- if (this.whb) {
- var1.drawImage(this.offimg, 0, 0, this);
- }
-
- }
-
- public boolean mouseDown(Event var1, int var2, int var3) {
- try {
- this.field_3 = new URL("" + this.link1);
- ((Applet)this).getAppletContext().showDocument(this.field_3, this.target_frame);
- return true;
- } catch (Exception var4) {
- return true;
- }
- }
-
- public void start() {
- if (this.runner == null || !this.runner.isAlive()) {
- this.runner = new Thread(this);
- }
-
- this.runner.start();
- }
-
- public void stop() {
- if (this.runner != null) {
- this.runner.stop();
- this.runner = null;
- }
-
- }
-
- public void destroy() {
- this.runner = null;
- }
-
- public boolean mouseEnter(Event var1, int var2, int var3) {
- if (this.whb) {
- if (this.field_4) {
- if (this.status_bar != null) {
- ((Applet)this).showStatus("" + this.status_bar);
- }
- } else {
- ((Applet)this).showStatus(" Unregistered version of MagicImage Java applet. URL: japplets.tripod.com");
- }
-
- this.runner.suspend();
- if (this.link1 == null) {
- return true;
- }
-
- if (this.link1.equals("") || this.link1.equals(" ")) {
- return true;
- }
-
- ((Frame)((Component)this).getParent()).setCursor(12);
- }
-
- return true;
- }
-
- public boolean mouseExit(Event var1, int var2, int var3) {
- if (this.whb) {
- ((Applet)this).showStatus("");
- this.runner.resume();
- ((Frame)((Component)this).getParent()).setCursor(0);
- }
-
- return true;
- }
-
- public void run() {
- ((Component)this).show();
- this.genislik = ((Component)this).size().width;
- this.yukseklik = ((Component)this).size().height;
- if (!this.whb) {
- this.offimg = ((Component)this).createImage(this.genislik, this.yukseklik);
- this.offScreeng = this.offimg.getGraphics();
- }
-
- this.whb = true;
- ((Component)this).repaint();
-
- try {
- this.tracker.waitForAll();
- } catch (InterruptedException var4) {
- }
-
- if (this.tracker.isErrorAny()) {
- this.durum = 1;
- this.errstr = "Image Error !";
- } else {
- this.imgw = this.imgust.getWidth(this);
- this.imgh = this.imgust.getHeight(this);
- this.imgwidth = this.imgalt.getWidth(this);
- this.imgheight = this.imgalt.getHeight(this);
- this.field_1 = 0;
- this.field_2 = 0;
- if (this.image_align != null && this.imgw < this.genislik) {
- if (this.image_align.equals("center")) {
- this.field_1 = (this.genislik - this.imgw) / 2;
- }
-
- if (this.image_align.equals("right")) {
- this.field_1 = this.genislik - this.imgw;
- }
- }
-
- if (this.image_valign != null && this.imgh < this.yukseklik) {
- if (this.image_valign.equals("center")) {
- this.field_2 = (this.yukseklik - this.imgh) / 2;
- }
-
- if (this.image_valign.equals("bottom")) {
- this.field_2 = this.yukseklik - this.imgh;
- }
- }
-
- int var1 = 0;
- int var2 = 0;
- this.kaplaboy = 0;
- this.kaplayuk = 0;
- if (this.imgwidth >= this.genislik) {
- this.kaplaboy = this.imgwidth + this.imgwidth;
- var1 = 1;
- } else {
- while(this.kaplaboy < this.genislik) {
- this.kaplaboy += this.imgwidth;
- ++var1;
- }
-
- this.kaplaboy += this.imgwidth;
- }
-
- if (this.imgheight >= this.yukseklik) {
- this.kaplayuk = this.imgheight;
- var2 = 0;
- } else {
- while(this.kaplayuk < this.yukseklik) {
- this.kaplayuk += this.imgheight;
- ++var2;
- }
-
- --var2;
- }
-
- this.offimg2 = ((Component)this).createImage(this.kaplaboy, this.yukseklik);
- this.offScreeng2 = this.offimg2.getGraphics();
- this.offScreeng2.setColor(this.bgc);
- this.offScreeng2.fillRect(0, 0, this.kaplaboy, this.yukseklik);
-
- for(this.don2 = 0; this.don2 <= var2; ++this.don2) {
- for(this.don = 0; this.don <= var1; ++this.don) {
- this.offScreeng2.drawImage(this.imgalt, this.don * this.imgwidth, this.don2 * this.imgheight, this);
- }
- }
-
- this.offScreeng2.dispose();
- this.field_0 = -this.imgwidth;
- this.durum = 2;
- }
-
- this.field_0 = -this.imgwidth;
- if (this.infostr != null) {
- if (!this.infostr.equals("Applet by Gokhan Dagli,japplets.tripod.com")) {
- this.durum = 1;
- this.errstr = "info parameter error!";
- }
- } else {
- this.durum = 1;
- this.errstr = "info parameter error!";
- }
-
- ((Component)this).repaint();
-
- while(true) {
- try {
- Thread.sleep((long)this.delay_time);
- } catch (InterruptedException var3) {
- }
-
- if (this.scroll_way.equals("false")) {
- --this.field_0;
- if (this.field_0 <= -this.imgwidth) {
- this.field_0 = 0;
- }
- } else {
- ++this.field_0;
- if (this.field_0 >= 0) {
- this.field_0 = -this.imgwidth;
- }
- }
-
- ((Component)this).repaint();
- }
- }
- }
-